﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using WYL.Template.Common.Config;
using YinLong.Utils.Core.Extensions;
using YinLong.Utils.Core.Net;

namespace YinLong.TestWinform
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            // AppCfg.FileName = "00";
            //
            //   var t= AppCfg.Instance;
            var s = " a ; d ; ";

            var z = s.Split(new string[] { "; " }, StringSplitOptions.None);

            var mtd = new MultiThreadDownloader("http://2f4qw2n0.vod2.danghongyun.com/target/mp4/2020/02/28/1579_0bc3cd0c052b4e6fbdfbd1118a7c8713_10_1280x720.mp4", Environment.GetEnvironmentVariable("temp"), "E:\\1579_0bc3cd0c052b4e6fbdfbd1118a7c8713_10_1280x720.mp4", 8);
            mtd.Configure(req =>
            {
                req.Referer = "https://masuit.com";
                req.Headers.Add("Origin", "https://baidu.com");
            });
            mtd.TotalProgressChanged += (sender, e) =>
            {
                var downloader = sender as MultiThreadDownloader;
                Console.WriteLine("下载进度：" + downloader.TotalProgress + "%");
                Console.WriteLine("下载速度：" + downloader.TotalSpeedInBytes / 1024 / 1024 + "MBps");
            };
            mtd.FileMergeProgressChanged += (sender, e) =>
            {
                Console.WriteLine("下载完成");
            };
            mtd.Start();//开始下载

            var i = YinLong.Utils.Core.StringExtensions.CompressString("5664");
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
            
        }
    }
}
